using EasyRoads3D;
using System.Collections.Generic;
using UnityEngine;

public class MarkerScript : MonoBehaviour
{
	public float tension = 0.5f;

	public float ri;

	public float OOQOQQOO;

	public float li;

	public float ODODQQOO;

	public float rs;

	public float ODOQQOOO;

	public float ls;

	public float DODOQQOO;

	public float rt;

	public float qt;

	public float ODDQODOO;

	public float lt;

	public float ODDOQOQQ;

	public bool OQODDCOODQ;

	public bool ODQDOQOO;

	public float OOQQQOCQCD;

	public float ODOOQQOO;

	public Transform[] OOCODCOCQQs;

	public float[] trperc;

	public Vector3 oldPos = Vector3.zero;

	public bool autoUpdate;

	public bool changed;

	public Transform surface;

	public bool OCDQCOOOOC;

	private Vector3 position;

	private bool updated;

	private int frameCount;

	private float currentstamp;

	private float newstamp;

	private bool mousedown;

	private Vector3 lookAtPoint;

	public bool bridgeObject;

	public bool distHeights;

	public RoadObjectScript objectScript;

	public List<string> OQODQQDO = new List<string>();

	public List<bool> ODOQQQDO = new List<bool>();

	public List<bool> OQQODQQOO = new List<bool>();

	public List<float> ODDOQQOO = new List<float>();

	public string[] ODDOOQDO;

	public bool[] ODDGDOOO;

	public bool[] ODDQOOO;

	public float[] ODDQOODO;

	public float[] ODOQODOO;

	public float[] ODDOQDO;

	public int markerNum;

	public string distance = "0";

	public string OOOOQDCCQQ = "0";

	public string OCOQOQCDCD = "0";

	public bool newSegment;

	public float floorDepth = 2f;

	public float oldFloorDepth = 2f;

	public float waterLevel = 0.5f;

	public bool lockWaterLevel = true;

	public bool tunnelFlag;

	public bool sharpCorner;

	public bool snapMarker;

	public int markerInt;

	private void Start()
	{
	}

	private void OnDrawGizmos()
	{
		if (!(objectScript != null))
		{
			return;
		}
		if (!objectScript.OQCCDOOOCC)
		{
			Vector3 worldPosition;
			if (snapMarker && OQCQQDCCCO.terrain != null)
			{
				worldPosition = base.transform.position;
				float num = OQCQQDCCCO.terrain.SampleHeight(worldPosition);
				Vector3 vector = OQCQQDCCCO.terrain.transform.position;
				worldPosition.y = num + vector.y;
				base.transform.position = worldPosition;
			}
			Vector3 vector2 = base.transform.position - oldPos;
			if (OQODDCOODQ && oldPos != Vector3.zero && vector2 != Vector3.zero)
			{
				int num2 = 0;
				Transform[] oOCODCOCQQs = OOCODCOCQQs;
				foreach (Transform transform in oOCODCOCQQs)
				{
					transform.position += vector2 * trperc[num2];
					if (snapMarker && OQCQQDCCCO.terrain != null)
					{
						worldPosition = transform.position;
						worldPosition.y = OQCQQDCCCO.terrain.SampleHeight(worldPosition);
						transform.position = worldPosition;
					}
					num2++;
				}
			}
			if (oldPos != Vector3.zero && vector2 != Vector3.zero)
			{
				changed = true;
				if (objectScript.OQCCDOOOCC)
				{
					objectScript.OOOOODODCQ.specialRoadMaterial = true;
				}
			}
			oldPos = base.transform.position;
		}
		else if (objectScript.ODODDDOO)
		{
			base.transform.position = oldPos;
		}
	}

	private void SetObjectScript()
	{
		objectScript = base.transform.parent.parent.GetComponent<RoadObjectScript>();
		if (objectScript.OOOOODODCQ == null)
		{
			List<ODODDQQO> arr = OCDQDCQOCQ.OQOODCQQCO(objectManager: false);
			objectScript.ODODCDOOQC(arr, OCDQDCQOCQ.OQQQOOOOOC(arr), OCDQDCQOCQ.OQODCCCCCD(arr));
		}
	}

	private void GetMarkerCount()
	{
		int num = 0;
		foreach (Transform item in base.transform.parent)
		{
			if (item == base.transform)
			{
				markerInt = num;
				break;
			}
			num++;
		}
	}

	public void LeftIndent(float change, float perc)
	{
		ri += change * perc;
		if (ri < objectScript.indent)
		{
			ri = objectScript.indent;
		}
		OOQOQQOO = ri;
	}

	public void RightIndent(float change, float perc)
	{
		li += change * perc;
		if (li < objectScript.indent)
		{
			li = objectScript.indent;
		}
		ODODQQOO = li;
	}

	public void LeftSurrounding(float change, float perc)
	{
		rs += change * perc;
		if (rs < objectScript.indent)
		{
			rs = objectScript.indent;
		}
		ODOQQOOO = rs;
	}

	public void RightSurrounding(float change, float perc)
	{
		ls += change * perc;
		if (ls < objectScript.indent)
		{
			ls = objectScript.indent;
		}
		DODOQQOO = ls;
	}

	public void LeftTilting(float change, float perc)
	{
		rt += change * perc;
		if (rt < 0f)
		{
			rt = 0f;
		}
		ODDQODOO = rt;
	}

	public void RightTilting(float change, float perc)
	{
		lt += change * perc;
		if (lt < 0f)
		{
			lt = 0f;
		}
		ODDOQOQQ = lt;
	}

	public void FloorDepth(float change, float perc)
	{
		floorDepth += change * perc;
		if (floorDepth > 0f)
		{
			floorDepth = 0f;
		}
		oldFloorDepth = floorDepth;
	}

	public bool InSelected()
	{
		for (int i = 0; i < objectScript.OOCODCOCQQs.Length; i++)
		{
			if (objectScript.OOCODCOCQQs[i] == base.gameObject)
			{
				return true;
			}
		}
		return false;
	}
}
